~function (desW) {
    var winW = document.documentElement.clientWidth;
    document.documentElement.style.fontSize = winW / desW * 100 + "px";
}(320);
/*划屏区域初始化*/


var mySwiper = new Swiper('.swiper-container', {
    pagination: '.swiper-pagination',
    direction: 'vertical',
    slidesPerView:1,
    paginationClickable: true,
    spaceBetween: 30,
    mousewheelControl: true,
    autoplay:3000,
    autoplayStopOnLast: true,
    loop : false,
    onInit: function (swiper) {
    swiper.myactive = 0;
       var myId = swiper.slides[swiper.myactive].getAttribute("trueId");
       console.log(swiper.myactive);
       for (var i = 0; i < swiper.slides.length; i++) {
           swiper.slides[i].id = i == swiper.myactive ? myId : null;
       }
    },
    onTransitionEnd: function (swiper) {
        swiper.myactive = swiper.activeIndex;
        var myId = swiper.slides[swiper.myactive].getAttribute("trueId");
        console.log(swiper.myactive);
        if(swiper.myactive==3){
            swiper.loop=false;
        }
        for (var i = 0; i < swiper.slides.length; i++) {
            swiper.slides[i].id = i == swiper.myactive ? myId : null;
        }
    }
});

// var swiper = new Swiper('.swiper-container', {
//
//         pagination: '.swiper-pagination',
//         direction: 'vertical',
//         paginationClickable: true,
//         // Disable preloading of all images
//         preloadImages: false,
//         // Enable lazy loading
//         lazyLoading: true,
//         lazyLoadingInPrevNext : true,
//         onInit: function(swiper){
//            swiperAnimateCache(swiper);
//            swiperAnimate(swiper);
//         },
//         onTransitionEnd: function (swiper) {
//                swiper.myactive = swiper.activeIndex;
//                var myId = swiper.slides[swiper.myactive].getAttribute("trueId");
//                //console.log(swiper.myactive);
//                for (var i = 0; i < swiper.slides.length; i++) {
//                    swiper.slides[i].id = i == swiper.myactive ? myId : null;
//                }
//            }
//
//     });





/*音频的自动播放*/
// ~function () {
//     var audioBox=document.querySelector(".audio"),
//         myAudio=audioBox.getElementsByTagName("audio")[0];
//     window.setTimeout(function () {
//         myAudio.play();
//         myAudio.addEventListener("canplay",function () {
//             audioBox.style.display="block";
//             audioBox.className+=" audioMove";
//         },false);
//     },1000);
//     audioBox.addEventListener("click",function () {
//         if(myAudio.paused){
//             myAudio.play();
//             audioBox.className="audio audioMove";
//             return;
//         }
//         myAudio.pause();
//         audioBox.className="audio";
//     },false);
//
// }();
